x11 drag: Fix mapped error
authorAlexander Larsson <alexl@redhat.com>
Thu, 14 May 2020 07:42:53 +0000 (09:42 +0200)
committerAlexander Larsson <alexl@redhat.com>
Thu, 14 May 2020 07:54:34 +0000 (09:54 +0200)
In the gtk-demo drag-and-drop demo i can't drag anything, all I get
is:

(gtk4-demo:358993): Gdk-CRITICAL **: 09:36:19.617: Surface 0x7e1bb0 has not been mapped in GdkSeatGrabPrepareFunc

This is because GdkX11Drag.ipc_surface is not considered mapped, even
though we called gdk_x11_surface_show() on it, because the
GDK_SURFACE_STATE_WITHDRAWN flag is still set.

I added calls to gdk_synthesize_surface_state() to match what
e.g. show_popup() and gdk_x11_toplevel_present() does.

gdk/x11/gdkdrag-x11.c

index 3ae250c9657e5ae40a377ceb65a8c4d4435ed25d..61160f94061f5109e98316301153c8c92789d4d4 100644 (file)
@@ -2028,6 +2028,8 @@ _gdk_x11_surface_drag_begin (GdkSurface         *surface,
   x11_drag->ipc_surface = ipc_surface;
   if (gdk_x11_surface_get_group (surface))
     gdk_x11_surface_set_group (x11_drag->ipc_surface, surface);
+
+  gdk_synthesize_surface_state (x11_drag->ipc_surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
   gdk_x11_surface_show (x11_drag->ipc_surface, FALSE);
 
   x11_drag->drag_surface = create_drag_surface (display);